package com.goldenautumn.prefabricate.activity.mine.adapter

import android.content.Context
import android.view.ViewGroup
import androidx.core.content.ContextCompat
import com.chad.library.adapter4.BaseQuickAdapter
import com.chad.library.adapter4.viewholder.DataBindingHolder
import com.goldenautumn.prefabricate.R
import com.goldenautumn.prefabricate.business.entity.ExpressInfoVo
import com.goldenautumn.prefabricate.databinding.ItemLogisticsProgressBinding

class LogisticsProgressAdapter constructor(var isLast:Boolean) : BaseQuickAdapter<ExpressInfoVo, DataBindingHolder<ItemLogisticsProgressBinding>>() {

    var selectPosition = -1

    override fun onBindViewHolder(holder: DataBindingHolder<ItemLogisticsProgressBinding>, position: Int, item: ExpressInfoVo?) {
        if (item == null) return
        var mBinding = holder.binding
        mBinding.time.text = "${item.time}"
        mBinding.title.text = "${item.context}"
        mBinding.time.setTextColor(ContextCompat.getColor(context,if(isLast && position == 0)R.color.color_1D1F20 else qncx.external.common.R.color.color_999999))
        mBinding.title.setTextColor(ContextCompat.getColor(context,if(isLast && position == 0)R.color.color_1D1F20 else qncx.external.common.R.color.color_999999))
    }

    override fun onCreateViewHolder(
        context: Context,
        parent: ViewGroup,
        viewType: Int
    ): DataBindingHolder<ItemLogisticsProgressBinding> {
        return DataBindingHolder(R.layout.item_logistics_progress, parent)
    }
}